package 初始线程;
//方法5：采用lambda，本质上也是匿名内部类
public class Demo_6 {
    public static void main(String[] args) {
        Thread t = new Thread( ()-> {//()内是形参列表
            while(true){
                System.out.println("111");
                try {
                    Thread.sleep(500);
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
            }
        });

        t.start();

        while(true){
            System.out.println("222");
            try {
                Thread.sleep(500);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }
    }
}
